import userApi from '@/config/server/api/user.js'
import customerApi from '@/config/server/api/customer'
import biAPi from '@/config/server/api/bi'
import dt from '@dt/dt'
//导入模板下载
function templateDownload() {
  let data = {
    fileName: '线索导入模板.xls'
  }
  return customerApi.clueBatch.templateDownload.fetch(data).then((res) => {
    console.log(res)
  })
}
// 上传线索文件
function importFile(params) {
  let data = { ...params }
  let upload = customerApi.clueBatch.importFile
  upload.setData(data)
  return upload
}

//导入批次列表查询
function getBatchList(info) {
  return customerApi.clueBatch.getBatchList.fetch(info).then(res => {
    return res
  })
}

//删除批次
function deleteByBatchId(info) {
  return customerApi.clueBatch.deleteByBatchId.fetch(info).then(res => {
    return res
  })
}

//按批次下载文件
function downloadByBatchId(info) {
  return customerApi.clueBatch.downloadByBatchId.fetch(info).then(res => {
    return res
  })
}

// 获取导入记录详情列表
function getOperationDetailList(info) {
  return customerApi.clueBatch.getOperationDetailList.fetch(info).then(res => {
    return res
  })
}

//分配已导入的线索
function allocateImportedClue(info) {
  return customerApi.clueBatch.allocateImportedClue.fetch(info).then(res => {
    return res
  })
}

//删除待导入详情记录
function deleteByDetailIds(info) {
  return customerApi.clueBatch.deleteByDetailIds.fetch(info).then(res => {
    return res
  })
}

//导出已分配详情列表
function downloadOperationDetailList(info) {
  return customerApi.clueBatch.downloadOperationDetailList.fetch(info).then(res => {
    return res
  })
}

//撤销分配记录
function cancelByIds(info) {
  return customerApi.clueBatch.cancelByIds.fetch(info).then(res => {
    return res
  })
}
//根据案场查询所有顾问
function adviserList(info) {
  return userApi.customer.adviserList.fetch(info).then(res => {
    return res
  })
}

//导入客户统计
function getImportedClueList(info) {
  return biAPi.importedClue.getImportedClueList.fetch(info).then(res => {
    return res
  })
}

//导出已导入客户统计
function exportImportedClue(info) {
  return biAPi.importedClue.exportImportedClue.fetch(info).then(res => {
    return res
  })
}

export default {
  templateDownload,
  importFile,
  getBatchList,
  downloadByBatchId,
  deleteByBatchId,
  getOperationDetailList,
  allocateImportedClue,
  deleteByDetailIds,
  cancelByIds,
  adviserList,
  downloadOperationDetailList,
  exportImportedClue,
  getImportedClueList
}